child_mortality
## # A tibble: 44,926 x 10
## year country continent population child_mort survival_per_wo~
## <int> <chr> <chr> <int> <dbl> <dbl>
## 1 1957 Afghan~ Asia 9147286 378. 4.75
## 2 1958 Afghan~ Asia 9314915 372. 4.80
## 3 1959 Afghan~ Asia 9489453 366. 4.85
## 4 1960 Afghan~ Asia 9671046 361. 4.89
## 5 1961 Afghan~ Asia 9859928 355. 4.94
## 6 1962 Afghan~ Asia 10056480 350. 4.98
## 7 1963 Afghan~ Asia 10261254 344. 5.02
## 8 1964 Afghan~ Asia 10474903 339. 5.07
## 9 1965 Afghan~ Asia 10697983 334. 5.11
## 10 1966 Afghan~ Asia 10927724 329. 5.15
## # ... with 44,916 more rows, and 4 more variables: deaths_per_woman <dbl>,
## # poverty <dbl>, education <dbl>, health_exp <dbl>
d <- select(death, everything())
rate <- child_mortality
rate %>%
filter(year >= 1957 & !is.na(continent)) %>%
group_by(continent, year) %>%
summarise(child_mort = sum(child_mort, na.rm = TRUE)) %>%
ggplot(aes(x = year, y = child_mort, color = continent)) +
geom_point() +geom_line()+ facet_wrap(~continent,nrow=1)+
theme_dark() + scale_color_manual(values = c("black","pink","gray","purple","violet"))+
labs(
title = "Child Mortality by Continent and by Year",
x = "Year",
y = "The Number of Children dying before the age of 5 years (per 1,000 births)"
)
## `summarise()` regrouping output by 'continent' (override with `.groups` argument)
I am trying to reproduce a graph from []https://ourworldindata.org/child-mortality The graph shows how the number of deaths for children under 5 years has been changing between 1990 and 2017
data <- read.csv("C:/Users/exoni/Downloads/child-deaths-igme-data.csv")
da <- filter(data,Year>=1990)
dat <- da %>% group_by(Year) %>% summarise(World=sum(deaths))
## `summarise()` ungrouping output (override with `.groups` argument)
dat$World <- dat$World/1000000
P <- ggplot(dat)+geom_line(aes(Year,World),color="blue",size=1)+geom_point(aes(Year,World),color="blue",size=3)+labs(y= "Number of Deaths in the World(in millions)",title="Number of Child Death, 1990-2017. \n Number of Deaths of children under 5 years old.")+theme_bw()
ggplotly(P, tooltip=c("World","Year"),width = 1000, height = 600) %>%
animation_opts(17)